<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>AdWords API Documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><link rel="stylesheet" href="../css/template.css" type="text/css"></link></head><body><div id="content"><h1 class="file">Common/Util/MapUtils.php</h1><div id="file-nav-box"><div id="file-nav-container"><ul id="file-nav"><li><a href="#classes"><img src="../images/icons/class.png" alt="Class" height="14"></img>
                          Classes
                      </a><ul><li><a href="#\MapUtils">\MapUtils</a></li></ul></li></ul><div style="clear: left;"></div></div><div id="file-nav-tab">
              Table of Contents
          </div></div><a name="top" class="anchor"></a><div id="file-description"><div class="short-description">A collection of utility methods for working with maps (associative arrays).</div><div class="long-description"><p>PHP version 5</p>

<p>Copyright 2011, Google Inc. All Rights Reserved.</p>

<p>Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at</p>

<pre><code>http://www.apache.org/licenses/LICENSE-2.0
</code></pre>

<p>Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</p></div></div><dl class="file-info"><dt>Author</dt><dd>Eric Koleda
         
    </dd><dt>Author</dt><dd>Vincent Tsao
         
    </dd><dt>Category</dt><dd>WebServices
         
    </dd><dt>Copyright</dt><dd>2011, Google Inc. All Rights Reserved.
         
    </dd><dt>License</dt><dd>http://www.apache.org/licenses/LICENSE-2.0 Apache License,
            Version 2.0
         
    </dd><dt>Package</dt><dd>GoogleApiAdsCommon
         
    </dd><dt>Subpackage</dt><dd>Util
         
    </dd></dl><a name="classes" class="anchor"></a><a id="\MapUtils" class="anchor"></a><h2 class="class">\MapUtils<div class="to-top"><a href="#top">jump to top</a></div></h2><div class="class"><small class="package"><b>Package: </b>GoogleApiAdsCommon\Util</small><div class="short-description">A collection of utility methods for working with maps (associative arrays).</div><div class="long-description"></div><dl class="class-info"></dl><h3>Methods</h3><div><a id="\MapUtils::GetMap()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">GetMap</span><span class="nb-faded-text">(array $mapEntries)</span> : array</code><div class="description"><span class="attribute">static</span><p class="short_description">Gets a map (associative array) from an array of map entries.</p></div><div class="code-tabs"><div class="long-description"><p>A map entry
is any object that has a key and value field.</p></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$mapEntries</th><td>array</td><td><em><p>an array of map entries</p></em></td></tr></table><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td>array</td><td>a map built from the keys and values of the map entries</td></tr></table></div><div class="clear"></div></div><a id="\MapUtils::GetMapEntries()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">GetMapEntries</span><span class="nb-faded-text">(array $map, string $mapEntryClassName = NULL)</span> : array</code><div class="description"><span class="attribute">static</span><p class="short_description">Gets an array of map entries from a map (associative array).</p></div><div class="code-tabs"><div class="long-description"><p>A map entry
is any object that has a key and value field. An optional map entry class
name can be specified for constructing the entries, otherise the stdClass
is used.</p></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$map</th><td>array</td><td><em><p>a map from key to value</p></em></td></tr><tr><th>$mapEntryClassName</th><td>string</td><td><em><p>an optional class name to use when
    constructing the map entries</p></em></td></tr></table><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td>array</td><td>an array of map entries built from the key-value pairs in
    the map</td></tr></table></div><div class="clear"></div></div><a id="\MapUtils::IsMap()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">IsMap</span><span class="nb-faded-text">(array $array)</span> : bool</code><div class="description"><span class="attribute">static</span><p class="short_description">Determines if an array is a map (associative array) vs.</p></div><div class="code-tabs"><div class="long-description"><p>a flat,
numerically indexed array.</p></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$array</th><td>array</td><td><em><p>the array to evaluate</p></em></td></tr></table><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td>bool</td><td>true if the array is a map, false otherwise</td></tr></table></div><div class="clear"></div></div><a id="\MapUtils::MapToMethodParameters()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">MapToMethodParameters</span><span class="nb-faded-text">(array $map, <a href="../files/http://php.net/manual/en/class.reflectionmethod.php">\ReflectionMethod</a> $method)</span> : array</code><div class="description"><span class="attribute">static</span><p class="short_description">Converts a map (associative array) to a flat, numerically indexed array
of method parameters.</p></div><div class="code-tabs"><div class="long-description"><p>The method is used to determine the order of the
parameters, and NULL values are using for missing parameters.</p></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$map</th><td>array</td><td><em><p>the map of parameter names to values</p></em></td></tr><tr><th>$method</th><td><a href="../files/http://php.net/manual/en/class.reflectionmethod.php">\ReflectionMethod</a></td><td><em><p>the method to use for the mapping</p></em></td></tr></table><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td>array</td><td>the parameter values as a flat array</td></tr></table></div><div class="clear"></div></div><a id="\MapUtils::__construct()" class="anchor"></a><div class="method private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">__construct</span><span class="nb-faded-text">()</span> : void</code><div class="description"><p class="short_description">The MapUtils class is not meant to have any instances.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Details</strong><dl class="function-info"><dt>Access</dt><dd>private
         
    </dd></dl></div><div class="clear"></div></div></div></div></div><small class="footer">
            Documentation was generated by
            <a href="http://phpdoc.org">phpDocumentor
                2.0.0a12</a>.
        </small></body></html>
